<template>
  <div class="link flex">
    <table border="1" class="tabledata">
      <tr>
        <td colspan="21" class="bg" style="font-size: 16px; font-weight: bold">产品销售及化工类原料进出厂情况</td>
      </tr>
      <tr>
        <td rowspan="15"><div style="width: 40px;">焦炭产品销售</div></td>
        <td rowspan="2" style="width: 60px;"><div>用户名称</div></td>
        <td colspan="2">干焦</td>
        <td colspan="2">焦丁</td>
        <td colspan="2">湿焦粉</td>
        <td colspan="2">干焦粉</td>
        <td colspan="2">焦末</td>
        <td rowspan="20" style="width: 40px;"><div style="width: 40px;">化工类产品销售情况</div></td>
        <td rowspan="2" style="width: 40px;"><div style="width: 40px;">序号</div></td>
        <td rowspan="2">产品名称</td>
        <td rowspan="2">出厂车数</td>
        <td rowspan="2">出厂净重(t)</td>
        <td rowspan="2">月累计出厂(t)</td>
        <td rowspan="2">库存</td>
        <td rowspan="2">备注</td>
      </tr>
      <tr>
        <td>日销</td>
        <td>月累计</td>
        <td>日销</td>
        <td>月累计</td>
        <td>日销</td>
        <td>月累计</td>
        <td>日销</td>
        <td>月累计</td>
        <td>日销</td>
        <td>月累计</td>
      </tr>
      <tr v-for="item in 9">
        <td>
          <input type="text" class="dinput" v-model="inputs[item - 1]['yhmc' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['yhmc' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['gjr' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['gjr' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['gjy' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['gjy' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['jdr' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['jdr' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['jdy' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['jdy' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['sjfr' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['sjfr' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['sjfy' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['sjfy' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['gjfr' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['gjfr' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['gjfy' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['gjfy' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['jmr' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['jmr' + item]}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs[item - 1]['jmy' + item]" v-if="!date.isup"/><span v-else>{{inputs[item - 1]['jmy' + item]}}</span>
        </td>
        <td>{{ item }}</td>
        <td><span>{{chuchang.length>=item?chuchang[item - 1]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=item?chuchang[item - 1]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=item?chuchang[item - 1]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=item?chuchang[item - 1]['yueleiji']:''}}</span></td>
        <td><input type="number" class="dinput" v-model="chuchang[item - 1]['kucun']" v-if="!date.isup  && chuchang.length>=item && chuchang[item - 1]['name']"/><span v-else>{{chuchang.length>=item?chuchang[item - 1]['kucun']:''}}</span></td>
        <td></td>
      </tr>
      <tr>
        <td>合计</td>
        <td><input type="number" class="dinput" v-model="gjrtotal" v-if="!date.isup"/><span v-else>{{gjrtotal}}</span></td>
        <td><input type="number" class="dinput" v-model="gjytotal" v-if="!date.isup"/><span v-else>{{gjytotal}}</span></td>
        <td><input type="number" class="dinput" v-model="jdrtotal" v-if="!date.isup"/><span v-else>{{jdrtotal}}</span></td>
        <td><input type="number" class="dinput" v-model="jdytotal" v-if="!date.isup"/><span v-else>{{jdytotal}}</span></td>
        <td><input type="number" class="dinput" v-model="sjfrtotal" v-if="!date.isup"/><span v-else>{{sjfrtotal}}</span></td>
        <td><input type="number" class="dinput" v-model="sjfytotal" v-if="!date.isup"/><span v-else>{{sjfytotal}}</span></td>
        <td><input type="number" class="dinput" v-model="gjfrtotal" v-if="!date.isup"/><span v-else>{{gjfrtotal}}</span></td>
        <td><input type="number" class="dinput" v-model="gjfytotal" v-if="!date.isup"/><span v-else>{{gjfytotal}}</span></td>
        <td><input type="number" class="dinput" v-model="jmrtotal" v-if="!date.isup"/><span v-else>{{jmrtotal}}</span></td>
        <td><input type="number" class="dinput" v-model="jmytotal" v-if="!date.isup"/><span v-else>{{jmytotal}}</span></td>
        <td>10</td>
        <td><span>{{chuchang.length>=10?chuchang[9]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=10?chuchang[9]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=10?chuchang[9]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=10?chuchang[9]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[9]['kucun']" v-if="!date.isup  && chuchang.length>=10 && chuchang[9]['name']"/>
          <span v-else>{{chuchang.length>=10?chuchang[9]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td colspan="2" rowspan="3">库存</td>
        <td colspan="6">65焦</td>
        <td colspan="3">湿焦</td>
        <td>11</td>
        <td><span>{{chuchang.length>=11?chuchang[10]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=11?chuchang[10]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=11?chuchang[10]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=11?chuchang[10]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[10]['kucun']" v-if="!date.isup  && chuchang.length>=11 && chuchang[10]['name']"/>
          <span v-else>{{chuchang.length>=11?chuchang[10]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td colspan="3">火运仓</td>
        <td colspan="3">筒仓</td>
        <td colspan="3"><input type="number" class="dinput" v-model="kcobj.shijiao" v-if="!date.isup"/><span v-else>{{kcobj.shijiao}}</span></td>
        <td>12</td>
        <td><span>{{chuchang.length>=12?chuchang[11]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=12?chuchang[11]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=12?chuchang[11]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=12?chuchang[11]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[11]['kucun']" v-if="!date.isup  && chuchang.length>=12 && chuchang[11]['name']"/>
          <span v-else>{{chuchang.length>=12?chuchang[11]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td colspan="3"><input type="number" class="dinput" v-model="kcobj.jiao65" v-if="!date.isup"/><span v-else>{{kcobj.jiao65}}</span></td>
        <td colspan="3"><input type="number" class="dinput" v-model="kcobj.jiao63" v-if="!date.isup"/><span v-else>{{kcobj.jiao63}}</span></td>
        <td>总计：</td>
        <!-- <td colspan="2"><input type="number" class="dinput" v-model="kucunzongji" v-if="!date.isup"/><span v-else>{{kucunzongji}}</span></td> -->
        <td colspan="2"><span>{{kucunzongji}}</span></td>
        <td>13</td>
        <td><span>{{chuchang.length>=13?chuchang[12]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=13?chuchang[12]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=13?chuchang[12]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=13?chuchang[12]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[12]['kucun']" v-if="!date.isup  && chuchang.length>=13 && chuchang[12]['name']"/>
          <span v-else>{{chuchang.length>=13?chuchang[12]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td rowspan="8"><span v-if="uu!='销售部'">化工类原料进厂</span></td>
        <td rowspan="2"><span v-if="uu!='销售部'">序号</span></td>
        <td rowspan="2" colspan="2"><span v-if="uu!='销售部'">物料名称</span></td>
        <td rowspan="2" colspan="2"><span v-if="uu!='销售部'">进料车数</span></td>
        <td rowspan="2" colspan="2"><span v-if="uu!='销售部'">进料净重(t)</span></td>
        <td rowspan="2" colspan="2"><span v-if="uu!='销售部'">月累计进料(t)</span></td>
        <td rowspan="2" colspan="2"><span v-if="uu!='销售部'">库存</span></td>
        <td>14</td>
        <td><span>{{chuchang.length>=14?chuchang[13]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=14?chuchang[13]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=14?chuchang[13]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=14?chuchang[13]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[13]['kucun']" v-if="!date.isup  && chuchang.length>=14 && chuchang[13]['name']"/>
          <span v-else>{{chuchang.length>=14?chuchang[13]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td>15</td>
        <td><span>{{chuchang.length>=15?chuchang[14]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=15?chuchang[14]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=15?chuchang[14]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=15?chuchang[14]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[14]['kucun']" v-if="!date.isup  && chuchang.length>=15 && chuchang[14]['name']"/>
          <span v-else>{{chuchang.length>=15?chuchang[14]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>

      <tr>
        <td><span v-if="uu!='销售部'">1</span></td>
        <td colspan="2">{{jinchang.length>=1?jinchang[0]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=1?jinchang[0]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=1?jinchang[0]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=1?jinchang[0]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[0]['kucun']" v-if="!date.isup  && jinchang.length>=1 && jinchang[0]['name']"/>
          <span v-else>{{jinchang.length>=1?jinchang[0]['kucun']:''}}</span>
        </td>
        <td>16</td>
        <td><span>{{chuchang.length>=16?chuchang[15]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=16?chuchang[15]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=16?chuchang[15]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=16?chuchang[15]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[15]['kucun']" v-if="!date.isup  && chuchang.length>=16 && chuchang[15]['name']"/>
          <span v-else>{{chuchang.length>=16?chuchang[15]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td><span v-if="uu!='销售部'">2</span></td>
        <td colspan="2">{{jinchang.length>=2?jinchang[1]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=2?jinchang[1]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=2?jinchang[1]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=2?jinchang[1]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[1]['kucun']" v-if="!date.isup  && jinchang.length>=2  && jinchang[1]['name']"/>
          <span v-else>{{jinchang.length>=2?jinchang[1]['kucun']:''}}</span>
        </td>
        <td>17</td>
        <td><span>{{chuchang.length>=17?chuchang[16]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=17?chuchang[16]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=17?chuchang[16]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=17?chuchang[16]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[16]['kucun']" v-if="!date.isup  && chuchang.length>=17 && chuchang[16]['name']"/>
          <span v-else>{{chuchang.length>=17?chuchang[16]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>
      <tr>
        <td><span v-if="uu!='销售部'">3</span></td>
        <td colspan="2">{{jinchang.length>=3?jinchang[2]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=3?jinchang[2]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=3?jinchang[2]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=3?jinchang[2]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[2]['kucun']" v-if="!date.isup  && jinchang.length>=3  && jinchang[2]['name']"/>
          <span v-else>{{jinchang.length>=3?jinchang[2]['kucun']:''}}</span>
        </td>
        <td>18</td>
        <td><span>{{chuchang.length>=18?chuchang[17]['name']:''}}</span></td>
        <td><span>{{chuchang.length>=18?chuchang[17]['cheshu']:''}}</span></td>
        <td><span>{{chuchang.length>=18?chuchang[17]['net']:''}}</span></td>
        <td><span>{{chuchang.length>=18?chuchang[17]['yueleiji']:''}}</span></td>
        <td>
          <input type="number" class="dinput" v-model="chuchang[17]['kucun']" v-if="!date.isup  && chuchang.length>=18 && chuchang[17]['name']"/>
          <span v-else>{{chuchang.length>=18?chuchang[17]['kucun']:''}}</span>
        </td>
        <td></td>
      </tr>

      <tr>
        <td><span v-if="uu!='销售部'">4</span></td>
        <td colspan="2">{{jinchang.length>=4?jinchang[3]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=4?jinchang[3]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=4?jinchang[3]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=4?jinchang[3]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[3]['kucun']" v-if="!date.isup  && jinchang.length>=4 && jinchang[3]['name']"/>
          <span v-else>{{jinchang.length>=4?jinchang[3]['kucun']:''}}</span>
        </td>
        <td rowspan="3" colspan="8">
          <textarea cols="80" rows="3" v-model="content" v-if="!date.isup"></textarea>
          <div v-else style="white-space: pre-line;text-align: left;">{{content}}</div>
        </td>
      </tr>
      <tr>
        <td><span v-if="uu!='销售部'">5</span></td>
        <td colspan="2">{{jinchang.length>=5?jinchang[4]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=5?jinchang[4]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=5?jinchang[4]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=5?jinchang[4]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[4]['kucun']" v-if="!date.isup  && jinchang.length>=5  && jinchang[4]['name']"/>
          <span v-else>{{jinchang.length>=5?jinchang[4]['kucun']:''}}</span>
        </td>
      </tr>
      <tr>
        <td><span v-if="uu!='销售部'">6</span></td>
        <td colspan="2">{{jinchang.length>=6?jinchang[5]['name']:''}}</td>
        <td colspan="2">{{jinchang.length>=6?jinchang[5]['cheshu']:''}}</td>
        <td colspan="2">{{jinchang.length>=6?jinchang[5]['net']:''}}</td>
        <td colspan="2">{{jinchang.length>=6?jinchang[5]['yueleiji']:''}}</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="jinchang[5]['kucun']" v-if="!date.isup  && jinchang.length>=6 && jinchang[5]['name']"/>
          <span v-else>{{jinchang.length>=6?jinchang[5]['kucun']:''}}</span>
        </td>
      </tr>
    </table>
  </div>
</template>

<script lang="ts" setup name="cpxsjhglyljcqk">
import cache from "@/utils/cache";
import { getCpxsjhglyljcqk, cpxsjhglyljcqkSave, cpxsjhglyljcqkSubmit } from "@/api/report";

// const ykc = ref(['甲醇','纯苯','甲苯','二甲苯','重苯','非芳烃','C8+'])

const arr = [];
const arr1 = [];
const arr2 = [];
// 循环生成绑定数据  一共9行
for (let i = 1; i <= 9; i++) {
  arr.push({
    ["yhmc" + i]: "",
    ["gjr" + i]: "",
    ["gjy" + i]: "",
    ["jdr" + i]: "",
    ["jdy" + i]: "",
    ["sjfr" + i]: "",
    ["sjfy" + i]: "",
    ["gjfr" + i]: "",
    ["gjfy" + i]: "",
    ["jmr" + i]: "",
    ["jmy" + i]: "",
  });
  arr1.push({
    name: "",
    net: "",
    cheshu: "",
    yueleiji: "",
    kucun: "",
  });
  arr2.push({
    name: "",
    net: "",
    cheshu: "",
    yueleiji: "",
    kucun: "",
  });
}
// 整表 数据绑定
const inputs = ref(arr);
const jinchang = ref(arr1);
const chuchang = ref(arr2);

const content = ref('记事：')

// 合计
const gjrtotal = ref(0);
const gjytotal = ref(0);
const jdrtotal = ref(0);
const jdytotal = ref(0);
const sjfrtotal = ref(0);
const sjfytotal = ref(0);
const gjfrtotal = ref(0);
const gjfytotal = ref(0);
const jmrtotal = ref(0);
const jmytotal = ref(0);

const kcobj = ref({
  jiao65:0,
  jiao63:0,
  shijiao:0,
});

const kucunzongji = ref(0);
watch(kcobj, async (n) => {
  // if(n.jiao65!='0.00'||n.jiao63!='0.00'||n.shijiao!='0.00'){
  //   kucunzongji.value = (n.jiao65 + n.jiao63 + n.shijiao).toFixed(2)
  // }
  if(n.jiao65!='0.00'||n.jiao63!='0.00'){
    kucunzongji.value = (parseFloat(n.jiao65) + parseFloat(n.jiao63)).toFixed(2)
  }
},{ deep: true })

// 深层监听数据修改  根据数据变化 从新计算合计
watch(inputs, async (n) => {
  let i = 1;
  let a = 0, b = 0,c = 0,d = 0,e = 0,f = 0,g = 0,h = 0,j = 0,k = 0;
  n.forEach((item)=>{
    a += Number(item['gjr'+i])
    b += Number(item['gjy'+i])
    c += Number(item['jdr'+i])
    d += Number(item['jdy'+i])
    e += Number(item['sjfr'+i])
    f += Number(item['sjfy'+i])
    g += Number(item['gjfr'+i])
    h += Number(item['gjfy'+i])
    j += Number(item['jmr'+i])
    k += Number(item['jmy'+i])
    
    i++
  });
  
  gjrtotal.value = a.toFixed(2)
  gjytotal.value = b.toFixed(2)
  jdrtotal.value = c.toFixed(2)
  jdytotal.value = d.toFixed(2)
  sjfrtotal.value = e.toFixed(2)
  sjfytotal.value = f.toFixed(2)
  gjfrtotal.value = g.toFixed(2)
  gjfytotal.value = h.toFixed(2)
  jmrtotal.value = j.toFixed(2)
  jmytotal.value = k.toFixed(2)
},{ deep: true })

const save = async () => {
  let userInfo = cache.get('userInfo')
  await cpxsjhglyljcqkSave({
    gjrtotal:gjrtotal.value,
    gjytotal:gjytotal.value,
    jdrtotal:jdrtotal.value,
    jdytotal:jdytotal.value,
    sjfrtotal:sjfrtotal.value,
    sjfytotal:sjfytotal.value,
    gjfrtotal:gjfrtotal.value,
    gjfytotal:gjfytotal.value,
    jmrtotal:jmrtotal.value,
    jmytotal:jmytotal.value,
    jiao65:kcobj.value.jiao65,
    jiao63:kcobj.value.jiao63,
    shijiao:kcobj.value.shijiao,
    kucunzongji:kucunzongji.value,
    inputs:inputs.value,
    jinchang:jinchang.value,
    chuchang:chuchang.value,
    aid: userInfo.id,
    aname: userInfo.name,
    content:content.value,
    date:date.date,
  })
}
const uu = ref(cache.get('role_name'))
const submit = async () => {
  await cpxsjhglyljcqkSubmit({
    label:uu.value,
    date:date.date,
  })
}

onMounted(() => {
  getData()
})

const getData = async () => {
  getCpxsjhglyljcqk(date).then((res)=>{
    console.log('==========',res)
    if(res.is.length>0){
      let newarr = []
      res.is.forEach((item,i)=>{
        let obj = {
          ['yhmc'+(i+1)]:item.yhmc,
          ['gjr'+(i+1)]:item.gjr,
          ['gjy'+(i+1)]:item.gjy,
          ['jdr'+(i+1)]:item.jdr,
          ['jdy'+(i+1)]:item.jdy,
          ['sjfr'+(i+1)]:item.sjfr,
          ['sjfy'+(i+1)]:item.sjfy,
          ['gjfr'+(i+1)]:item.gjfr,
          ['gjfy'+(i+1)]:item.gjfy,
          ['jmr'+(i+1)]:item.jmr,
          ['jmy'+(i+1)]:item.jmy,
        }
        newarr.push(obj)
      })
      content.value = res.is[0].content
      gjrtotal.value = res.is[0].gjrtotal
      gjytotal.value = res.is[0].gjytotal
      jdrtotal.value = res.is[0].jdrtotal
      jdytotal.value = res.is[0].jdytotal
      sjfrtotal.value = res.is[0].sjfrtotal
      sjfytotal.value = res.is[0].sjfytotal
      gjfrtotal.value = res.is[0].gjfrtotal
      gjfytotal.value = res.is[0].gjfytotal
      jmrtotal.value = res.is[0].jmrtotal
      jmytotal.value = res.is[0].jmytotal
      kcobj.value = {
        jiao65:res.is[0].jiao65,
        jiao63:res.is[0].jiao63,
        shijiao:res.is[0].shijiao,
      }
      kucunzongji.value = res.is[0].kucunzongji;
      inputs.value = newarr
    }else{
      inputs.value = arr
    }
    if(res.sqlserver.hasOwnProperty('0')){
      // 进厂数据
      if(res.sqlserver[0].length>0&&uu.value!='销售部'){
        jinchang.value = res.sqlserver[0]
      }else{
        jinchang.value = arr1
      }
      // 出厂数据
      if(res.sqlserver[1].length>0){
        chuchang.value = res.sqlserver[1]
      }else{
        chuchang.value = arr2
      }
    }else{
      jinchang.value = arr1
      chuchang.value = arr2
    }
    
  })
}
const date = defineProps(['date','isup'])
watch(date, async (n) => {
  getData()
})

defineExpose({
  save,
  submit
})

</script>

<style lang="scss" scoped>
.tabledata {
  width: 100%;
  border: 1px solid #aaa;
  td {
    text-align: center;
    border: 1px solid #aaa;
    padding: 3px;
  }
  .bg{
    background: #ccc;
  }
  .dinput{
    text-align: center;
    border-radius: 5px;
    width: 80px;
    border: 1px solid #ccc;
  }
}
</style>
